|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A tag handler is responsible to - handle the attributes for the tags it supports - translate the tag sequence including attributes to another language - back-translate relative line offsets.
Tag handlers are used by translators via tag handler factories.
XXX: This is work in progress and can change anytime until API for 3.0 is frozen.
ITranslator
,
ITagHandlerFactory
Method Summary | |
void |
addAttribute(String name,
String value,
int sourceLineNumber)
Adds an attribute to this tag handler. |
int |
backTranslateOffsetInLine(String sourceLine,
String translatedLine,
int offsetInTranslatedLine)
Computes the offset in the source line that corresponds to the given offset in the translated line. |
boolean |
canHandleTag(String tag)
Tells whether this handler can handle the given tag. |
boolean |
canHandleText(String text)
Tells whether this handler can handle the given text. |
void |
processEndTag(ITranslatorResultCollector resultCollector,
int sourceLineNumber)
Writes the tag and line mapping information to the given translator result collector. |
void |
reset(String tag)
Resets this handler and sets the current tag to the given tag. |
Method Detail |
public boolean canHandleTag(String tag)
tag
- the tag to check
true
if this handler handles the given tagpublic boolean canHandleText(String text)
true
if this handler handles the given textpublic void addAttribute(String name, String value, int sourceLineNumber)
name
- the name of the attributevalue
- the attribute valuesourceLineNumber
- the line number of the attribute in the source or -1
if unknownpublic void reset(String tag)
Resetting the handler clears the attributes.
tag
- the tag to check
true
if this handler handles the given tagpublic void processEndTag(ITranslatorResultCollector resultCollector, int sourceLineNumber) throws IOException
resultCollector
- the translator's result collectorsourceLineNumber
- the line number of the attribute in the source or -1
if unknown
IOException
public int backTranslateOffsetInLine(String sourceLine, String translatedLine, int offsetInTranslatedLine)
translatedLine
- the translated lineoffsetInTranslatedLine
- the offset in the translated line
-1
if
it was not possible to compute the offset
|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |